<?php
class ProductTag extends Model {
	public function addTag($p_id,$tag) {
		return $this->dbo->query("INSERT INTO product_tag (product_id,tag) VALUES ('".$p_id."','".$this->dbo->escape($tag)."')");
	}
	public function getProductTagByPId($product_id){
		$result = $this->dbo->query("SELECT pt.* FROM product_tag pt WHERE pt.product_id = '".(int)$this->dbo->escape($product_id)."'");
		return $result->rows;
	}
	public function delTagByPid($product_id){
		return $this->dbo->query("DELETE FROM product_tag WHERE product_id ='".(int)$product_id."'");
	}
}
?>